from typing import Literal

from django import template

register = template.Library()


@register.filter(name="ifinlist_checked")
@register.filter
def ifinlist(list1, list2) -> Literal["checked", " "]:
    list2 = list2.split(",")
    for item in list1:
        if item in list2:
            return "checked"
    return " "
